package
{
	import com.greensock.*;
	import com.greensock.easing.*;
	import com.greensock.motionPaths.*;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.display.Shape
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author Aydarka
	 */
	public class Maun extends Sprite
	{
		
		private var mousePrevX:Number = 0;
		private var mousePrevY:Number= 0;
		private var arrayX:Array;
		private var arrayY:Array;
		private var sprint:Sprite = new Sprite;
		public function Maun():void
		{
			arrayX = [];
				arrayY = [];
	stage.addEventListener(MouseEvent.MOUSE_DOWN, hand);	
	stage.addEventListener(MouseEvent.MOUSE_UP, finish);

		}
		private function hand(e:MouseEvent):void 
		{
			stage.addEventListener(Event.ENTER_FRAME, frame)
				
		}
		private function frame(e:Event):void 
		{
			if (mouseX-mousePrevX>100 || mouseY-mousePrevY>100||mouseX-mousePrevX<-100 || mouseY-mousePrevY<-100) 
			{
				trace("mouseX-mousePrevX>10")
				mousePrevX = mouseX;
				mousePrevY = mouseY;
				arrayX.push(mousePrevX);
				arrayY.push(mousePrevY);
			}
		}
		private function finish(e:MouseEvent):void 
		{
			stage.removeEventListener(Event.ENTER_FRAME, frame)
			for (var i:int = 0; i < arrayX.length; i++) 
			{
				var mac:Sprite = new Sprite;
				mac.graphics.beginFill(0xff00ff,1)
				mac.graphics.drawRect(0,0,50,50)
				mac.graphics.endFill();
				mac.x=arrayX[i]
				mac.y=arrayY[i]
					addChild(mac);
					
			}
			mousePrevX = 0;
			mousePrevY = 0;
			arrayX = new Array
			arrayY = new Array
			
		}
	}

}